extends "../nigulasi-3/nigulasi-3.gd"


var baseId = ""
var upText1 = "均衡鱼雷额外发射一枚鱼雷"
var upText2 = "火力全开伤害提高35%"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("每{cd}秒向前方依次发射3枚穿甲鱼雷，每枚鱼雷对直线上的敌人造成[雷击*1.5]的可暴击技能伤害", "火力全开", "liuLianLei", 10)
var p4 = 1
func upgrade():
	.upgrade()
	if upgraded == 1:
		p2 = 3
	if upgraded == 2:
		p4 = 1.35
func _castCdSkill(id):
	._castCdSkill(id)
	if id == "liuLianLei" && aiCha != null:
		liuLianLei()

func liuLianLei():
	for i in range(3):
		yield(reTimer(0.4),"timeout")
		ef()

func ef():
	utils.createSkillTextEff("火力全开", position)
	if aiCha == null:
		var skill = getSkill("liuLianLei")
		skill.nowTime += 2
		return
	var eff2:Eff = sys.newEff("animEff", position)
	eff2.setImgs(sys.getBasePath() + "/eff/thunderFly", 9, true)
	eff2._initFlyPos(position + (aiCha.position - position).normalized() * 1000, 350)
	eff2.normalSpr.position=Vector2(0, -30)
	eff2.connect("onInCell",self,"effInCell")

func effInCell(cell):
	var cha = matCha(cell)
	if cha == null:
		cha = matCha(cell + Vector2(0, 1))
	if cha != null && cha.team != team:
		azurHurtChara(cha, min(cha.att.maxHp*1.2, att.mgiAtk*1.5), sys.HurtType.WEAPON, sys.AtkType.SKILL, "火力全开", true, p4)